<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">

    <!--Inicia la composicion de la pagina en la plantilla-->
    <ui:composition template="/resource/template/plantilla.xhtml">

        <!--Segmento que define el contenido del header-->
        <ui:define name="head">
            <h:head>
                <f:loadBundle basename="person.general.label_#{logged.loggedIdiom}"  var="label" />
                <f:loadBundle basename="person.general.message_#{logged.loggedIdiom}" var="message" />
                <f:loadBundle basename="person.general.help_#{logged.loggedIdiom}" var="help" />
                <script>
                    function verificar(dato)
                    {
                        var agree = confirm(dato);
                        if (agree)
                            return true;
                        else
                            return false;
                    }
                </script>
            </h:head>
        </ui:define>

        <!--Segmento que define el contenido de la pagina-->
        <ui:define name="content">
            <h:body>
                <h:outputText value="#{message.m0}" class="label" rendered="#{!access.visit}"/>
                <h:form id="formPersona" rendered="#{access.visit}">  
                    <p:growl id="messages" showDetail="true"/>  
                    <div class="field">
                        <h:outputText value="#{label.field2}"  class="label"/>
                        <h:inputText id="dni" class="textfield" value="#{person_general.dni}" 
                                     size="11" maxlength="30" required="#{param['required']=='true'}" 
                                     requiredMessage="#{message.m22}"/>
                        <h:outputText class="required" value="*"/>

                    </div>

                    <div class="field">
                        <h:outputText value="#{label.field4}" class="label"/>
                        <h:inputText id="nombre" class="textfield" value="#{person_general.nombre}" 
                                     size="16" maxlength="50"  required="#{param['required']=='true'}" 
                                     requiredMessage="#{message.m23}"/>
                        <h:outputText class="required" value="*"/>
                    </div>

                    <div class="field">
                        <h:outputText value="#{label.field6}" class="label"/>
                        <h:inputText value="#{person_general.alias}" class="textfield"/>
                    </div>

                    <div class="field">
                        <h:outputText value="#{label.field5}" class="label"/>
                        <h:inputText id="apellido" class="textfield" value="#{person_general.apellido}" 
                                     required="#{param['required']=='true'}" requiredMessage="#{message.m24}"/>
                        <h:outputText class="required" value="*"/>
                    </div>

                    <div class="field">
                        <h:outputText value="#{label.field7}" class="label"/>
                        <p:calendar value="#{person_general.nacimiento}" effect="slide" navigator="true"
                                    readonlyInput="true" pattern="dd/MM/yy" yearRange="c-82:c+10"
                                    required="#{param['required']=='true'}" requiredMessage="#{message.m24}" size="5"/>
                        <h:outputText class="required" value="*"/>
                    </div>

                    <div class="field">
                        <h:outputText value="#{label.field8}" class="label"/>
                        <h:selectOneRadio value="#{person_general.idl_sexo}" class="radioButton">  
                            <f:selectItem itemLabel="#{label.sexo1}" itemValue="1" />  
                            <f:selectItem itemLabel="#{label.sexo2}" itemValue="2" />  
                        </h:selectOneRadio> 
                    </div>

                    <div class="field">
                        <h:outputText value="#{label.field9}" class="label"/>
                        <h:selectOneRadio value="#{person_general.idl_estadoCivil}" class="radioButton">  
                            <f:selectItem itemLabel="#{label.estado1}" itemValue="1" />  
                            <f:selectItem itemLabel="#{label.estado2}" itemValue="2" />  
                            <f:selectItem itemLabel="#{label.estado3}" itemValue="3" />  
                            <f:selectItem itemLabel="#{label.estado4}" itemValue="4" /> 
                            <f:selectItem itemLabel="#{label.estado5}" itemValue="5" /> 
                        </h:selectOneRadio> 
                    </div>

                    <div class="field">
                        <h:outputText value="#{label.field10}" class="label"/>
                        <h:selectOneRadio value="#{person_general.idl_tipoSangre}" class="radioButton">  
                            <f:selectItem itemLabel="#{label.sangre1}" itemValue="1" />  
                            <f:selectItem itemLabel="#{label.sangre2}" itemValue="2" />  
                            <f:selectItem itemLabel="#{label.sangre3}" itemValue="3" />  
                            <f:selectItem itemLabel="#{label.sangre4}" itemValue="4" /> 
                            <f:selectItem itemLabel="#{label.sangre5}" itemValue="5" /> 
                            <f:selectItem itemLabel="#{label.sangre6}" itemValue="6" /> 
                            <f:selectItem itemLabel="#{label.sangre7}" itemValue="7" /> 
                            <f:selectItem itemLabel="#{label.sangre8}" itemValue="8" /> 
                        </h:selectOneRadio> 
                    </div>

                    <h:commandButton value="#{label.button1}" class="button" 
                                     actionListener="#{person_general.insert}" 
                                     rendered="#{access.add}" onclick="return verificar('#{message.m7}')">
                        <f:param name="required" value="true"/>
                    </h:commandButton>
                    <h:commandButton value="#{label.button2}" class="button" 
                                     actionListener="#{person_general.update}" 
                                     rendered="#{access.update}" onclick="return verificar('#{message.m8}')">
                        <f:param name="required" value="true"/>
                    </h:commandButton>
                    <h:commandButton value="#{label.button3}" class="button" 
                                     actionListener="#{person_general.delete}" 
                                     rendered="#{access.delete}" onclick="return verificar('#{message.m9}')"/>
                    <h:commandButton value="#{label.button4}" class="button" 
                                     actionListener="#{person_general.clear}"/>
                    <h:commandLink target="_blank" rendered="#{logged.masterId ne 0 and access.visit}"
                                   actionListener="#{person_generalReport.curriculum}" 
                                   value="#{label.button8}" class="button">
                    </h:commandLink>
                </h:form>
            </h:body>
        </ui:define>

        <!--Segemento donde se define un texto de ayuda para que el usuario pueda utilizar el formulario del contenido-->
        <ui:define name="slideHelper">
            <h3>#{help.title1}</h3>
            #{help.detail1a}
            <p>
                #{help.title2}
                <ul>
                    <li>#{help.datail2a}</li>
                </ul>
            </p>
            <p>
                #{help.title3}
                <ul>
                    <li>#{help.datail3a}</li>
                </ul>
            </p>
            <p>
                #{help.title4}
                <ul>
                    <li>#{help.datail4a}</li>
                </ul>
            </p>

        </ui:define>
    </ui:composition>
</html>

